package com.example.cognitivesystemserver.controller;

import com.example.cognitivesystemserver.pojo.WarringResult;
import com.example.cognitivesystemserver.service.WarringService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
public class WarringController {

    @Autowired
    private WarringService warringService ;
    //返回具体某个学生预警信息
    @GetMapping("/warring/getWarringRes")
    public Object getWarringRes(String StuId){
        ModelAndView modelAndView=new ModelAndView();
        WarringResult warringRes = warringService.getWarringRes(StuId);
        modelAndView.addObject("warringRes",warringRes);
        modelAndView.setViewName("warringRes");
        return warringRes;
    }

    //返回全部预警信息
    @GetMapping("/warring/getAllWarring")
    public Object getAllWarring() {
        ModelAndView modelAndView=new ModelAndView();
        List<WarringResult> allWarring = warringService.getAllWarring();
        modelAndView.addObject("allWarring",allWarring);
        modelAndView.setViewName("allWarring");
        return allWarring;
    }
}
